package com.fanxuankai.boot.monitor.prometheus;

import com.fanxuankai.boot.monitor.Monitor;
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.annotation.Bean;
import retrofit2.Retrofit;
import retrofit2.converter.gson.GsonConverterFactory;

/**
 * @author fanxuankai
 */
@EnableConfigurationProperties({PrometheusProperties.class})
@ConditionalOnClass({Retrofit.class, GsonConverterFactory.class})
@ConditionalOnProperty(PrometheusProperties.PREFIX + "." + PrometheusProperties.ENABLED)
public class PrometheusAutoConfiguration {
    @Bean
    public Monitor prometheusMonitor() {
        return new PrometheusMonitor();
    }
}
